package com.ruoyi.management.order.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.management.branch.domain.TBranch;
import com.ruoyi.management.order.ro.*;
import com.ruoyi.management.order.service.DriverOrderManagementService;
import com.ruoyi.management.order.vo.GetDriverOrderManagementListVo;
import com.ruoyi.management.order.vo.RelationCollectPageVo;
import com.ruoyi.management.order.vo.SeleteAddressVo;
import com.ruoyi.passenger.order.ro.GetHistoricalOrderParam;
import com.ruoyi.passenger.order.service.ITOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * 订单Controller
 *
 * @author ruoyi
 * @date 2021-12-01
 */
@RestController
@Api(tags = "管理端--订单查询")
@RequestMapping("/order-management")
public class DriverOrderManagementController extends BaseController {
    @Autowired
    private DriverOrderManagementService driverOrderManagementService;

    /**
     * {TODO}
     *订单查询
     * @param  * @param param
     * @return com.ruoyi.common.core.page.TableDataInfo
     * @throws
     * @Author: xly
     */
    @GetMapping("/ddcx")
    @ApiOperation("订单查询")
    public TableDataInfo<List<GetDriverOrderManagementListVo>> getOrderList(@Valid GetDriverOrderManagementListParam param)
    {
        startPage();
        List<GetDriverOrderManagementListVo> list = driverOrderManagementService.getOrderList(param);
        return getDataTable(list);
    }

    @GetMapping("/pjxx")
    @ApiOperation("评价信息查询")
    public AjaxResult getOrderEvaluateByOrderId(@Valid GetDriverOrderEvaluateManagementParam param){
        return AjaxResult.success(driverOrderManagementService.getOrderEvaluateByOrderId(param));
    }

    @GetMapping("/relation-collect-page")
    @ApiOperation("关联营运数据列表")
    public TableDataInfo<List<RelationCollectPageVo>> relationCollectPage(@Valid RelationCollectPageParam param)
    {
        startPage();
        List<RelationCollectPageVo> list = driverOrderManagementService.relationCollectPage(param);
        return getDataTable(list);
    }

    @GetMapping("/selete-address")
    @ApiOperation("获取地址信息")
    public AjaxResult seleteAddress(@Valid SeleteAddressParam param)
    {
        SeleteAddressVo vo = driverOrderManagementService.seleteAddress(param);
        return AjaxResult.success(vo);
    }

    @GetMapping("/relation")
    @ApiOperation("关联")
    public AjaxResult relation(@Valid RelationParam param)
    {
        return toAjax(driverOrderManagementService.relation(param));
    }

    @GetMapping("/cancel-relation")
    @ApiOperation("取消关联")
    public AjaxResult cancelRelation(@Valid CancelRelationParam param)
    {
        return toAjax(driverOrderManagementService.cancelRelation(param));
    }
}
